<?php

namespace Upfor\UpforPHP\Interfaces;

interface CacheInterface {

    /**
     * Store data in the cache
     *
     * @param  string  $key
     * @param  mixed   $value
     * @param  integer $ttl
     * @return boolean
     */
    public function set($key, $value, $ttl = null);

    /**
     * Returns TRUE if the cache key exists and FALSE if not
     *
     * @param  string $key Cache key
     * @return boolean
     */
    public function has($key);

    /**
     * Fetch data from the cache
     *
     * @param  string $key
     * @return mixed|false
     */
    public function get($key);

    /**
     * Delete data from the cache
     *
     * @param  string $key
     * @return boolean
     */
    public function delete($key);

    /**
     * Clears the cache
     *
     * @return boolean
     */
    public function clear();

    /**
     * Increment
     *
     * @param  string $key
     * @param  mixed  $value
     * @return mixed
     */
    public function increment($key, $value = 1);

    /**
     * Decrement
     *
     * @param  string $key
     * @param  mixed  $value
     * @return mixed
     */
    public function decrement($key, $value = 1);

    /**
     * Is support persistent?
     *
     * @return boolean
     */
    public function persistent();

}
